package com.md.drcs.dicom.dao;

import com.md.common.utils.dao.MyMapper;
import com.md.drcs.dicom.entity.ReportEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ReportDao extends MyMapper<ReportEntity> {

    @Select("select top 1 * from t_report where nStuId = #{studyId} and nType = 0  ")
    ReportEntity findByStudyId(Long studyId);

    @Select("select top 1 * from t_report where nStuId = #{studyId} and nType = 1 ")
    ReportEntity findByStudyIdForConsul(Long studyId);

    @Select("<script>" +
            "select * from t_report where nStuId in " +
            " <foreach collection='studyIds' item='studyId' open='(' separator=',' close=')'>" +
            " #{studyId}" +
            " </foreach>" +
            "</script>")
    List<ReportEntity> findByStudyIds(@Param("studyIds") List<Long> studyIds);
}
